import requests

sess_obj = requests.Session()   # 创建一个Session类
sess_obj.get('http://httpbin.org/cookies/set/sessioncookie/123456789')  # 在测试网站设置Cookie
response = sess_obj.get('http://httpbin.org/cookies')   # 再次请求网站

print(response.text)   # 跨请求时可以成功保持Cookie信息


requests.get('http://httpbin.org/cookies/set/sessioncookie/123456789')
response = requests.get('http://httpbin.org/cookies')

print(response.text)  # 两次请求完全独立，无法保持Cookie信息
